package testJdk.commonUse.number.testDouble;

import cn.hutool.core.util.NumberUtil;
import org.junit.Test;

/**
 * @version 1.0.0
 * Created by cyd on 2022-04-28 17:58:19
 * @ClassName : learn_jdk.num.doubleTest.DoubleTester
 * @Description : 类描述
 */
public class DoubleTester {

    /**
     * 测试保留4位小数
     */
    @Test
    public void test01() {
        int int01 = 1;
        int int02 = 3;
        double num01 = NumberUtil.div(int01, int02, 4);
        System.out.println(num01);
    }

    /**
     * 测试保留##.####%
     */
    @Test
    public void test011() {
        int int01 = 1;
        int int02 = 3;
        double num01 = NumberUtil.div(int01, int02, 6);
        String s = NumberUtil.decimalFormat("#.####%", num01);
        System.out.println(s);
    }

    /**
     * 测试乘以100
     */
    @Test
    public void test02() {
        int int01 = 1;
        int int02 = 3;
        double num01 = NumberUtil.div(int01, int02, 4);
        double num02 = num01 * 100;
        System.out.println(num02);
    }

    /**
     * 测试乘以100
     */
    @Test
    public void test03() {
        long int01 = 1023667;
        long int02 = 125933;
        double num01 = NumberUtil.div(int01, int02, 4);
        double num02 = num01 * 100;
        System.out.println(num01 * 100);
    }

    /**
     *
     */
    @Test
    public void test04() {
//        System.out.println(Double.valueOf(null)); 会报空指针
    }
}
